

* These DTA files were exported form the raw SAS files using: /projects/data_external/lbd/code/sas_to_dta.sas

clear
gen lbdnum = ""
cd /projects/data_external/lbd/data
save lbd_slim, replace

forvalues i = 1976/2018 {

display in red "------ Year: `i' -------"

cd /projects/data_external/lbd/data/raw
use lbd`i', clear
keep year lbdnum firmid lbdfid ein bds_emp pay bds_vcnaics

compress
cd /projects/data_external/lbd/data
append using lbd_slim
save lbd_slim, replace

}

cd /projects/data_external/lbd/data
use lbd_slim, clear


clear
gen lbdfid = ""
cd /projects/data_external/lbd/data
save lbdfirm_slim, replace

forvalues i = 1976/2018 {

cd /projects/data_external/lbd/data/raw
use lbdfirm`i', clear
keep year lbdfid firmid firmsize_bds_emp firmsize_bds_pay firmage_emp firmage_pay

compress
cd /projects/data_external/lbd/data
append using lbdfirm_slim
save lbdfirm_slim, replace
 
}


cd /projects/data_external/lbd/data
use lbdfirm_slim, clear
order lbdfid firmid year
sort lbdfid year
compress
save lbdfirm_slim, replace

cd /projects/data_external/lbd/data
use lbdfirm_slim, clear
mdesc
duplicates report lbdfid year
duplicates report firmid year

